#include <iostream>
#include <stdlib.h>
using namespace std;
int main()
{
	char s[1000],num[100],word[100],other[100];
	int k1=0,k2=0,k3=0;
	cin>>s;
	for(int i=0;s[i]!='\0';i++)
	{
		if(s[i]>='0'&&s[i]<='9')
			num[k1++]=s[i];
		else if(s[i]>='a'&&s[i]<='z'||s[i]>='A'&&s[i]<='Z')
			word[k2++]=s[i];
		else
			other[k3++]=s[i];
	}
	for(int i=0;i<k1;i++)
		cout<<num[i];
	cout<<endl;
	for(int i=0;i<k2;i++)
		cout<<word[i];
	cout<<endl;
	for(int i=0;i<k3;i++)
		cout<<other[i];
	cout<<endl;
	return 0;
}